package com.source.baseData.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.source.baseData.entity.Stalls;
import com.source.baseData.mapper.StallsMapper;
import com.source.baseData.service.StallsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.source.labelAndBarcode.vo.StallsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author Joey
 * @since 2021-02-10
 */
@Service
public class StallsServiceImpl extends ServiceImpl<StallsMapper, Stalls> implements StallsService {

    @Autowired
    StallsMapper stallsMapper;

    @Override
    public List<StallsVo> findAll() {
        return stallsMapper.findAll();
    }

    @Override
    public IPage<StallsVo> findAllOnPagination(Page<StallsVo> page) {
        return stallsMapper.findAllOnPagination(page);
    }

    @Override
    public List<StallsVo> findAllOnMultiStatus(int i) {
        return stallsMapper.findAllOnMultiStatus(i);
    }

    @Override
    public IPage<StallsVo> findAllOnMultiStatusAndPagination(Page<StallsVo> page, int i) {
        return stallsMapper.findAllOnMultiStatusAndPagination(page, i);
    }

    @Override
    public List<StallsVo> findByLikeName(String name) {
        return stallsMapper.findByLikeName("%" + name + "%");
    }

    @Override
    public IPage<StallsVo> findByLikeNameOnPagination(Page<StallsVo> page, String keyWord) {
        return stallsMapper.findByLikeNameOnPagination(page, "%" + keyWord + "%");
    }

    @Override
    public List<StallsVo> findByUserId(String userId) {
        return stallsMapper.findByUserId(userId);
    }

    @Override
    public List<StallsVo> findBySlaughterHouseId(String slaughterHouseId) {
        return stallsMapper.findBySlaughterHouseId(slaughterHouseId);
    }

    @Override
    public IPage<StallsVo> findByUserIdOnPagination(Page<StallsVo> page, String userId) {
        return stallsMapper.findByUserIdOnPagination(page,userId);
    }

    @Override
    public IPage<StallsVo> findBySlaughterHouseIdOnPagination(Page<StallsVo> page, String slaughterHouseId) {
        return stallsMapper.findBySlaughterHouseIdOnPagination(page,slaughterHouseId);
    }

    @Override
    public StallsVo findById(String id) {
        return stallsMapper.findById(id);
    }

    @Override
    public IPage<StallsVo> findByUnChecked(Page<StallsVo> page) {
        return stallsMapper.findByUnChecked(page);
    }

    @Override
    public IPage<StallsVo> findByUnCheckedAndKeyWord(String keyWord, Page<StallsVo> page) {
        return stallsMapper.findByUnCheckedAndKeyWord("%"+keyWord+"%", page);
    }
}
